﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoVanHocTapData.Interface;
using CoVanHocTapData.Entities;
using CoVanHocTapData.Infrastructure;

namespace CoVanHocTapData.Concretes
{
    public class NguoiDungRepository:INguoiDungRepository
    {
        #region property
        DangKyPhuEntities entities;
        #endregion

        #region constructor
        public NguoiDungRepository()
        {
            entities = new DangKyPhuEntities();
        }
        #endregion

        public bool KiemTraAdminDangNhap(string tenDN, string pass)
        {

            var result = from m in entities.NguoiDungs
                         where m.TenDangNhap.Equals(tenDN)
                         && m.MatKhau.Equals(pass)
                         select m;
            if (result.Count() > 0)
                return true;
            return false;
        }




        public NguoiDung LayAdminDangNhap(string tenDN)
        {
            return (from m in entities.NguoiDungs
                        where m.TenDangNhap.Equals(tenDN)
                        select m).FirstOrDefault();
        }
    }
}
